package com.itic.appbase.applications.openoffice;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.itic.appbase.framework.utils.CommandHelper;
import com.itic.appbase.framework.utils.configuration.PropertyHelper;

/**
 * pdf转swf类
 * <p>Company: itic</p>
 * 
 * @author: bianyuwu
 * @date: 2015年5月8日 上午9:25:28
 * @version: V1.0
 */
public class PdfToSwf {
    private static final Logger log = LoggerFactory.getLogger(PdfToSwf.class);

    /**
     * pdf转swf.
     * 
     * @param pdfPath pdf路径
     * @param swfPath swf路径
     * @return result
     */
    public static boolean pdfToSwf(String pdfPath, String swfPath) {
        String command = "";
        if (System.getProperty("os.name").contains("Windows")) {
            command = PropertyHelper.getString("windows.swftools.bin") + " -t " + pdfPath + " -o " + swfPath
                    + " -f -s flashversion=9 ";
        } else {
            command = PropertyHelper.getString("linux.swftools.bin") + " -t " + pdfPath + " -o " + swfPath
                    + " -f -s flashversion=9 ";
        }
        log.debug("即将执行命令：" + command);
        return CommandHelper.runCommand(command) == 0;
    }
}
